/* 预览图片 */
export function TanPreviewImage(imageUrl){ 
	console.log(imageUrl) // http://192.168.100.251:8990/6_1597822634094.png
	var images = [];
	images.push(imageUrl);
	console.log(images)  // ["http://192.168.100.251:8990/6_1597822634094.png"]
	uni.previewImage({ // 预览图片  图片路径必须是一个数组 => ["http://192.168.100.251:8990/6_1597822634094.png"]
		current:0,
		urls:images,
		longPressActions: {  //长按保存图片到相册
			itemList: ['保存图片'],
			success: (data)=> {
				console.log(data);
				if(data.tapIndex==0&&data.index==0){
					SaveImage(images);
				}
			},
			fail: (err)=> {
				console.log(err.errMsg);
			}
		}
	});
}
/* 保存图片 */
export function SaveImage(imageUrl){ 
	console.log(imageUrl) // http://192.168.100.251:8990/6_1597822634094.png
	uni.downloadFile({
		url: imageUrl[0], //仅为示例，并非真实的资源
		success: (res) => {
		   console.log(res)
			uni.saveImageToPhotosAlbum({  
				filePath: res.tempFilePath,  
				success: function() {  
					console.log("cg")
					uni.showToast({  
						title: "保存成功",  
						icon: "none"  
					});   
				},  
				fail: function() {  
					uni.showToast({  
						title: "保存失败",  
						icon: "none"  
					});  
				}  
			});  
		}
	});
}

